<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/7/19
 * Time: 16:04
 */
namespace Publish\Controller;
use Common\Controller\HomebaseController;
include '../Common/function.php';
class FirstController extends HomebaseController
{
    protected $terms_model;

    function _initialize() {
        parent::_initialize();
        $this->terms_model = D("Publish/SystemTerms");
    }
    public function index(){
        $id=I('id');
        $first_data=$this->terms_model
             ->where("term_id=$id")
             ->find();
        $first_children=$this->terms_model
             ->where("parent=$id")
             ->select();
        $term_info = $this->terms_model->find($id);
        if(!$term_info['imgs']){
            $first_data['has_img']=0;
        }else{
            $first_data['has_img']=1;
        }
        $this->assign('first_data',$first_data);
        $this->assign('first_children',$first_children);
		$this->display("first_m");
	}
    // 将军列表图片展示
    public function show(){
        $term_id = I("term_id"); //分类id
        $term_info = $this->terms_model->find($term_id);
        $term_info['imgs'] = json_decode($term_info['imgs'],true);
        $this->assign('term',$term_info['imgs']);
        $aa=isMobile();
        if($aa){
            $this->display("imgList_m");
        }else{
            $this->display();
        }
    }
}